<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div style="width: 730px;">
	<a class="layui-btn layui-btn-sm"
		href="javascript:loadPage('sequence/showAdd');"><i
		class="layui-icon">&#xe608;</i> 新增班次</a>
	<table class="layui-table" style="text-align: center;">
		<colgroup>
			<col width="100">
			<col width="100">
			<col width="100">
			<col width="80">
			<col width="80">
			<col width="60">
			<col>
		</colgroup>
		<thead>
			<tr>
				<th style="text-align: center">线路名称</th>
				<th style="text-align: center">起点</th>
				<th style="text-align: center">终点</th>
				<th style="text-align: center">发时</th>
				<th style="text-align: center">到时</th>
				<th style="text-align: center">状态</th>
				<th style="text-align: center">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${sequenceList }" var="item" varStatus="status">
				<tr>
					<td>${item.busLine.lineName }</td>
					<td>${item.busLine.startStation }</td>
					<td>${item.busLine.endStation }</td>
					<td>${item.startTime }</td>
					<td>${item.endTime }</td>
					<td>${item.runState }</td>
					<td><a class="layui-btn layui-btn-primary layui-btn-sm"
						href="javascript:loadPage('sequence/showUpd?sequenceId=${item.sequenceId }');">
							<i class="layui-icon">&#xe642;</i> 编辑
					</a>
						<button class="layui-btn layui-btn-primary layui-btn-sm"
							onclick="javascript:confirmDelete(this);"
							data-id="${item.sequenceId }">
							<i class="layui-icon">&#xe640;</i> 删除
						</button></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div id="demo1"></div>
</div>
<script>
	layui.laypage.render({
    	elem: 'demo1'
		,count: ${pageInfo.total}
		,curr:${pageInfo.pageNum}
		,groups:5
		,limit:${pageInfo.pageSize}
    	,jump: function(obj,first){
    		if(!first){
	    		loadPage("sequence/showAll?pageNum=" + obj.curr);
    		}
		}
	});
	function confirmDelete(that) {
		var othis = $(that)
		layui.layer.confirm('真的要删除这个班次吗?', {
			icon : 3,
			title : '警告'
		}, function(index) {
			var sequenceId = othis.data('id');
			loadPage("sequence/del?sequenceId=" + sequenceId);
			layui.layer.close(index);
		});
	}
</script>